package me.stone.stanimeclient.core.data.di

import android.content.Context
import dagger.Binds
import dagger.Module
import dagger.Provides
import dagger.hilt.InstallIn
import dagger.hilt.android.qualifiers.ApplicationContext
import dagger.hilt.components.SingletonComponent
import me.stone.stanimeclient.core.data.db.AppDatabase
import me.stone.stanimeclient.core.data.repository.RemoteFanDataRepository
import javax.inject.Singleton

@Module
@InstallIn(SingletonComponent::class)
object DataModule {
    @Singleton
    @Provides
    fun provideAppDatabase(@ApplicationContext context: Context): AppDatabase {
        return AppDatabase.buildDatabase(context)
    }
}

@Suppress("UNUSED")
@Module
@InstallIn(SingletonComponent::class)
abstract class RemoteFanDataRepositoryModule {

    /*
    // 资源爬取自某小众的番剧视频网，有能力的自行动手，但别公开
    // 我这里就不放了，毕竟该网还需要恰广告商的钱 :D
    @Singleton
    @Binds
    abstract fun bindRealFanRemoteRepoImpl(
        repoImpl: RealFanRemoteRepoImpl
    ): RemoteFanDataRepository
     */

    @Singleton
    @Binds
    abstract fun bindRemoteRepoImpl(
        repoImpl: FakeRemoteFanDataRepository
    ) : RemoteFanDataRepository

}